package cn.sirun.com.fca.personal.center.loader;

import android.support.annotation.NonNull;

import com.tencent.cloud.iov.recycler.flow.BaseRecyclerLoader;
import com.tencent.cloud.iov.recycler.item.IBlockItem;
import com.tencent.cloud.iov.util.ResourcesUtils;

import java.util.ArrayList;
import java.util.List;

import cn.sirun.com.fca.personal.center.R;
import cn.sirun.com.fca.personal.center.block.item.impl.NoticeSettingItem;
import cn.sirun.com.fca.personal.center.block.item.impl.NoticeSettingListItem;
import cn.sirun.com.fca.personal.center.block.item.impl.PersonalOptionsListItem;
import cn.sirun.com.fca.personal.center.block.item.impl.TitleBlockItem;
import io.reactivex.Observable;

public class NoticeSettingLoader extends BaseRecyclerLoader {
    @NonNull
    @Override
    protected Observable<List<IBlockItem>> getDataObservable() {
        return Observable.just(createBlockItems());
    }

    private List<IBlockItem> createBlockItems() {
        List<IBlockItem> list = new ArrayList<>();
        //告警通知
        TitleBlockItem alarmItem = new TitleBlockItem(
                ResourcesUtils.getString(R.string.alarm_notice));
        list.add(alarmItem);

        //告警通知-短信
        List<IBlockItem> alarmInfoItems = new ArrayList<>();
        NoticeSettingItem messageAItem = new NoticeSettingItem();
        messageAItem.setmTitle(ResourcesUtils.getString(R.string.message));
        messageAItem.setmTitleId(R.string.message);
        alarmInfoItems.add(messageAItem);

        //告警通知-短信
        NoticeSettingItem emialAItem = new NoticeSettingItem();
        emialAItem.setmTitle(ResourcesUtils.getString(R.string.email));
        emialAItem.setmTitleId(R.string.email);
        alarmInfoItems.add(emialAItem);

        //告警通知-APP通知
        NoticeSettingItem appAItem = new NoticeSettingItem();
        appAItem.setmTitle(ResourcesUtils.getString(R.string.app_notice));
        appAItem.setmTitleId(R.string.app_notice);
        alarmInfoItems.add(appAItem);

        list.add(new NoticeSettingListItem(alarmInfoItems));

        //被盗通知
        TitleBlockItem theftItem = new TitleBlockItem(
                ResourcesUtils.getString(R.string.theft_notice));
        list.add(theftItem);

        //被盗通知-短信
        List<IBlockItem> theftInfoItems = new ArrayList<>();
        NoticeSettingItem messageTItem = new NoticeSettingItem();
        messageTItem.setmTitle(ResourcesUtils.getString(R.string.message));
        messageTItem.setmTitleId(R.string.message);
        theftInfoItems.add(messageTItem);

        //被盗通知-短信
        NoticeSettingItem emialTItem = new NoticeSettingItem();
        emialTItem.setmTitle(ResourcesUtils.getString(R.string.email));
        emialTItem.setmTitleId(R.string.email);
        theftInfoItems.add(emialTItem);

        //被盗通知-APP通知
        NoticeSettingItem appTItem = new NoticeSettingItem();
        appTItem.setmTitle(ResourcesUtils.getString(R.string.app_notice));
        appTItem.setmTitleId(R.string.app_notice);
        theftInfoItems.add(appTItem);

        list.add(new NoticeSettingListItem(theftInfoItems));


        //月度报告邮件接收
        TitleBlockItem reportItem = new TitleBlockItem(
                ResourcesUtils.getString(R.string.report_accept));
        list.add(reportItem);
        NoticeSettingItem reportAcceptItem = new NoticeSettingItem();
        reportAcceptItem.setmTitle(ResourcesUtils.getString(R.string.accept_email));
        reportAcceptItem.setmTitleId(R.string.accept_email);
        list.add(reportAcceptItem);

        //月度报告邮件到达通知
        TitleBlockItem reportNoticeItem = new TitleBlockItem(
                ResourcesUtils.getString(R.string.report_accept_notice));
        list.add(reportNoticeItem);

        List<IBlockItem> reportNoticeInfoItems = new ArrayList<>();
        //被盗通知-短信
        NoticeSettingItem messageRItem = new NoticeSettingItem();
        messageRItem.setmTitle(ResourcesUtils.getString(R.string.message_notice));
        messageRItem.setmTitleId(R.string.message_notice);
        reportNoticeInfoItems.add(messageRItem);

        //被盗通知-APP通知
        NoticeSettingItem appRItem = new NoticeSettingItem();
        appRItem.setmTitle(ResourcesUtils.getString(R.string.app_notice));
        appRItem.setmTitleId(R.string.app_notice);
        reportNoticeInfoItems.add(appRItem);

        list.add(new NoticeSettingListItem(reportNoticeInfoItems));

        //告警说明
        TitleBlockItem explainItem = new TitleBlockItem(
                ResourcesUtils.getString(R.string.notice_explain));
        list.add(explainItem);
        return list;
    }
}
